/**
 * Moondance UML modeling tool
 * 
 * @author Dascalu Laurentiu (dascalu.laurentziu@gmail.com).
 * 
 * This program is free software; you can redistribute it and
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 3
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

package ro.pub.cs.se.moondance.xmi.converter;

import org.w3c.dom.Document;
import org.w3c.dom.Element;

public class UMLInheritanceConnectionXMI extends UMLConnectionXMI {

	public UMLInheritanceConnectionXMI(String id, String destination) {
		super(null, XMICommon.UML_CLASS, id, null, destination,
				null, null, null, null, null, null, null, null, null, null);
	}
	

	/**
	 * Example for INHERITANCE
	 * <packagedElement
	 * xmi:type="uml:Class"
	 * xmi:id="_4xhvEGcfEd6eLuBoYJyKmQ" // source
	 * name="InheritClass">
	 *     <generalization
	 *         xmi:id="_6SFi4GcfEd6eLuBoYJyKmQ"
	 *         general="_A9hI0GcPEd67F_7YoWwK5g"/> // target
	 * </packagedElement>
	 */
	
	@Override
	public void serialize(Element root, Document document) {
		/**
		 * !!! root should be reference to the class serialized tag !!!
		 */
		Element elementInheritance = document.createElement(XMICommon.GENERALIZATION);
		elementInheritance.setAttribute(XMICommon.XMI_ID, xmiID);
		elementInheritance.setAttribute(XMICommon.GENERAL, destination);
		root.appendChild(elementInheritance);
	}
}
